cmake_minimum_required( VERSION 2.6 )
project("MyMemory")

SET (CMAKE_BUILD_TYPE Debug)

ADD_DEFINITIONS(${QT_DEFINITIONS})
ADD_DEFINITIONS(-DQT_NETWORK)
ADD_DEFINITIONS(-DUNICODE)

find_package(Qt4 REQUIRED)
include(${QT_USE_FILE})


# Some compile options
IF(NOT MSVC)
    IF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
        SET (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC ")
    ENDIF("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")


SET (HEADERS mymemory.h)
SET (SOURCES mymemory.cpp)



# Wrapping Source files
qt4_wrap_cpp(MOC_SOURCES ${HEADERS})


# Compiling primary executable
add_library(mymemory ${SOURCES} ${MOC_SOURCES})
target_link_libraries(mymemory ${QT_LIBRARIES} ${QT_QTNETWORK_LIBRARIES} qxtjson)


# This hack necessary on fedora :)
#if (Q_WS_X11)
#    include_directories(${X11_Xlib_INCLUDE_PATH} )
 #   target_link_libraries(qphoenix ${X11_LIBRARIES})
#endif (Q_WS_X11)



# install for nix
if(${CMAKE_SYSTEM_NAME} STREQUAL Linux OR ${CMAKE_SYSTEM_NAME} STREQUAL FreeBSD)
    install(TARGETS qphoenix DESTINATION ${QGT_BINARY_PATH})
endif()


# install for windows
if(${CMAKE_SYSTEM_NAME} STREQUAL Windows OR ${CMAKE_SYSTEM_NAME} STREQUAL Os2)
    install(TARGETS qphoenix DESTINATION ${QGT_BINARY_PATH})
endif()
